<template>
  <div class="reset">
    <div class="reset_content">
        <div class="list_item" 
          v-for="item in navList"
          :key="item.title"
          @click="_route(item.type)"
        >
          <div class="left">
            <div class="icon_left"><img :src="item.icon" style="width:100%;height:100%;" alt=""></div>
            <p class="title">{{item.title}}</p>
          </div>
          <div class="icon" v-html="'&#xe635;'"></div>
        </div>
    </div>
    <div class="submit mainBgColor" @click="submit">退出登录</div>
  </div>
</template>

<script>
import { Dialog } from 'vant'
export default {
  data() {
    return {
      navList: [
        // {
        //   title: '修改登录密码',
        //   icon: require('../assets/password.png'),
        //   type: 1
        // }
      ]
    }
  },
  methods: {
    _route(e) {
      switch (e) {
        case 1:
          this.$router.push({name: 'change'})
          break
        case 2:
          this.$router.push({name: 'changeblank'})
          break
        case 3:
          console.log('设置交易密码')
          break
      }
    },
    submit() {
      Dialog.confirm({
        title: '标题',
        showCancelButton: true,
        confirmButtonColor: '#45B4DC',
        message: '您确定要退出吗?',
      }).then(() => {
        localStorage.removeItem('px_token')
        localStorage.removeItem('px_user_openid')
        this.$router.push({name: 'home'})
      }).catch(() => {
        console.log('catch')
      });
      
    }
  }
}
</script>

<style lang="scss" scoped>
  .reset {
    color: #333;
    background: #F6F8FC;
    width: 100%;
    height: 100%;
    padding-bottom: 20px;
    box-sizing: border-box;
    position: relative;
    .reset_content {
      display: flex;
      flex-direction: column;
      padding: 0px 16px;
      box-sizing: border-box;
      background: #fff;
      .list_item {
        width: 100%;
        height: 50px;
        box-sizing: border-box;
        border-top: 1px solid #F6F8FC;
        display: flex;
        align-items: center;
        justify-content: space-between;
        .left {
          display: flex;
          align-items: center;
          .icon_left {
            width: 24px;
            height: 22px;
            margin-right: 14px;
          }
        }
        .icon {
          font-size: 18px;
          font-weight: 500;
          color: #666666;
        }
      }
    }
    .submit {
      width: calc(100% - 32px);
      height: 44px;
      position: fixed;
      bottom: 40px;
      margin-top: 15px;
      margin-left: 16px;
      color: #fff;
      text-align: center;
      line-height: 44px;
      border-radius: 4px;
    }
  }
</style>